Mastering Windows PowerShell Scripting by Blawat Brenton J.W
Author:Blawat, Brenton J.W. [Blawat, Brenton J.W.]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2015-04-26T16:00:00+00:00
After executing this script, the file folder hierarchy should be as displayed in the preceding screenshot. This also displays that when you move the AppTesting directory to the Archive folder, it automatically performs the move recursively, keeping the file and folder structure intact.
Renaming files, folders, registry keys, and named values
When you are working with PowerShell scripts, you may have instances where you need to rename files, folders, and registry keys. The rename-item cmdlet can be used to perform renaming operations on a system. The syntax for this cmdlet is rename-item and specifying the –path argument with path to the original object, and then you call the –newname argument with a full path to what you want the item to be renamed to. The rename-item has a –force argument to force the rename in instances where the file or folder is hidden or restricted by UAC or to avoid prompting for the rename action.
To copy and rename files and folders, do the following action:
New-item –path "c:\Program Files\MyCustomSoftware\OldConfigFiles\" –ItemType Directory | out-null Rename-item –path "c:\Program Files\MyCustomSoftware\OldConfigFiles" –newname "c:\Program Files\MyCustomSoftware\ConfigArchive" -force copy-item –path "c:\Program Files\MyCustomSoftware\ConfigFile.txt" "c:\Program Files\MyCustomSoftware\ConfigArchive\ConfigFile.txt" –force Rename-item –path "c:\Program Files\MyCustomSoftware\ConfigArchive\ConfigFile.txt" –newname "c:\Program Files\MyCustomSoftware\ConfigArchive\Old_ConfigFile.txt" –force
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27119)
Hello! Python by Anthony Briggs(25972)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25310)
Kotlin in Action by Dmitry Jemerov(24415)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23612)
Dependency Injection in .NET by Mark Seemann(23326)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21963)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20867)
Grails in Action by Glen Smith Peter Ledbrook(19883)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17081)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16847)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14474)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12595)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11876)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10657)
Hit Refresh by Satya Nadella(9247)
The Kubernetes Operator Framework Book by Michael Dame(8594)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8449)
Robo-Advisor with Python by Aki Ranin(8394)